<%@ page language="java" import="java.util.*,com.entity.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>更新类型信息</title>

  <link rel="stylesheet" type="text/css" href="css/style.css">

  </head>
  <script>
function SubmitForm(){
	var form1=document.getElementById("form1");
	if(form1.typename.value=="" ){
		document.getElementById("typename_error").style.display="";
		return false;
	}else{
		document.getElementById("typename_error").style.display="none";
	}
}

function onloadtype()
{
     var typenames = document.getElementById("typenames");
     var xiang = document.getElementById("xiang");
     var ztypenames = document.getElementById("ztypenames").value;
     var typename1= document.getElementById("typename1");
     var zdparenttypename = document.getElementById("zdparenttypename").value;
     var typenameid=document.getElementById("typenameid").value;
     if(ztypenames=='部门')
     {
        document.getElementById("typename1").style.display="block";
       // for(var z=0;z<xiang.length;z++)
	     //{  
	       // if(typenameid==xiang[z].value)
	       // {
	       //    xiang[z].selected=true;
	       // }
	     //}
	     for(var i=0;i<typenames.length;i++)
	     {
	         if(ztypenames==typenames[i].value)
	         {
	             typenames[i].selected=true;
	         }
	     }
	     for(var j=0;j<typename1.length;j++)
	     {
	        if(zdparenttypename==typename1[j].value)
	        {
	            typename1[j].selected=true;
	        }
	     }
	     
     }
     else
     {
        document.getElementById("typename1").style.display="none";
        for(var j=0;j<typenames.length;j++)
        {
            if(ztypenames==typenames[j].value)
            {
                typenames[j].selected=true;
            }
        }
     }
}

function typenameschange(str)
{
      if(str=='部门')
      {
	        document.getElementById("typename1").style.display="";
      }
      else
	  {
		   document.getElementById("typename1").style.display="none";
	  }
 }
 

</script>
  <body onload="loaddw();selectedaddr();onloadtype();">
    <%Dlyh dlyh = (Dlyh)request.getSession().getAttribute("dlyh");  
    if((dlyh.getZd().getTypename().endsWith("乡")||dlyh.getZd().getTypename().equals("工业园区")||dlyh.getZd().getTypename().endsWith("镇")||dlyh.getZd().getTypename().endsWith("办")||dlyh.getZd().getTypename().endsWith("办事处")||dlyh.getZd().getTypename().endsWith("局")||dlyh.getZd().getTypename().endsWith("社")||dlyh.getZd().getTypename().endsWith("集团")||dlyh.getZd().getTypename().endsWith("院")||dlyh.getZd().getTypename().equals("民航"))){
   %>
  <input type="hidden" value="<%=request.getSession().getAttribute("shiqyid") %>" id="shiqyid" name="shiqyid" />
  <%}%>
  <input type="hidden" value="<%=dlyh.getZd().getParentid() %>" id="qyid" name="qyid" />
  <input type="hidden" value="<%=dlyh.getZd().getTypename() %>:<%=dlyh.getZd().getId() %>:<%=dlyh.getZd().getParentid() %>" id="dlyhzd" name="dlyhzd" />
  <input type="hidden" value="<%=request.getAttribute("shi") %>" id="shiid" name="shiid" />
  <input type="hidden" value="<%=request.getAttribute("xian") %>" id="xianid" name="xianid" />
  <input type="hidden" value="<%=request.getAttribute("xiang") %>" id="xiangid" name="xiangid" />
  <input type="hidden" value="<%=request.getAttribute("cun")%>" id="cunid" name="cunid" />
  <input type="hidden" value="<%=request.getAttribute("xianzhi") %>" id="xianzhi" name="xianzhi" />
  <script language="javascript" type="text/javascript" src="js/qy1.js"></script>
    <input type="hidden" value="${zd.typenames }" id="ztypenames" name="ztypenames" />
    <input type="hidden" value="${zdparentid.typename }" id="zdparenttypename" name="zdparenttypename" />
    
    <input type="hidden" value="${typename }:${typeid }" id="typenameid" name="typenameid" />
    
<div style="display: none;" id="PageHeader" class="PageHeader"></div>
<table class="TableTop" width="70%" align="center">
   <tbody><tr>
      <td class="left"></td>
      <td class="center subject">
         更新类型信息</td>
      <td class="right"></td>
   </tr>
</tbody></table>
<form action="zd.do?state=saveedit" method="post" id="form1" onSubmit="return SubmitForm();" name="form1" >
<input type="hidden" value="${zd.id }" id="zid" name="zid" />
<table class="TableBlock no-top-border" width="70%" align="center">
    <tbody><tr>
      <td class="TableData" width="100" nowrap="nowrap">类型：</td>
      <td class="TableData">
          <select id="typenames" name="typenames" onchange="typenameschange(this.value)">
            <%List list =(List) request.getSession().getAttribute("typenames"); 
              for(int i=0;i<list.size();i++)
              {%>
             <option value="<%=list.get(i) %>"><%=list.get(i) %></option>
                <% } %>
          </select> 
          
          <div id="typename1" name="typename1">

			<select disabled="disabled" id="sheng" name="sheng" >
           <option value="河北省">河北省</option>
        </select>市
        <select id="shi" name="shi" onchange="shichange(this.value)">
           <option>请选择市</option>
           <%List xianlist=(List) request.getSession().getAttribute("shilist"); 
            for(int i=0;i<xianlist.size();i++){%>
           <option value="<%=((Zd)xianlist.get(i)).getId() %>"><%=((Zd)xianlist.get(i)).getTypename() %></option>
           <%} %>
        </select>市
        <select id="xian" name="xian" onchange="xianchange(this.value)">
           <option>请选择县</option>
        </select>县
        <select id="xiang"  name="xiang" onchange="xiangchange(this.value)" >
         <option >请选择乡</option>
        </select>乡
        <select id="cun"  name="cun" >
        <option >请选择村</option>
        </select>村<br />

          </div>
      </td>
    </tr>
    <tr>
    <td class="TableData" width="100" nowrap="nowrap">类型分类名称：</td>
      <td class="TableData">
          <input type="text" name="typename" id="typename" value="${zd.typename }" />
          <span id="typename_error" style="color:red; display:none" >请输入类型分类名称</span>
      </td>
    </tr>
    <tr class="TableControl" align="center">
      <td colspan="2" nowrap="nowrap">
        
        <input id="btn_submit" value="修改" class="BigButtonB"  type="submit">&nbsp;&nbsp; <input id="btn_submit" value="返回" class="BigButtonB"  type="button" onClick="history.back();"></td>
    </tr>
  </tbody></table>
</form>
  <script type="text/javascript">
  function openwindow(str)
{
  window.open("doTree.jsp?sid="+str+"&pd=1","部门","height=380,width=260,top=230,left=250,scrollbars=yes"); 
   //showModalDialog("doTree.jsp","部门","height=380,width=260,top=230,left=250,scrollbars=yes");
}
</script>
  </body>
</html>